<template>
	<view>
		<!-- <button @click="select">选择图片</button>
    <image mode="widthFix" :src="path" />
    <ksp-cropper mode="free" :width="200" :height="140" :maxWidth="1024" :maxHeight="1024" :url="url" @cancel="oncancel"
      @ok="onok"></ksp-cropper> -->
		<button @click="but1">ss</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url: "",
				path: "",
				works: {
					id: "",
					orderId: '1',
					phone: '2',
					tbAccount: '3',
					worksName: '4',
					texture: 0,
					textures: this.$store.state.textures,
					size: 0,
					sizes: this.$store.state.sizes,
					remark: '123'
				}
			}
		},
		onLoad() {
			// uni.uploadFile({
			// 	url: this.api.customWorks,
			// 	formData: {
			// 		'customWorksJson': JSON.stringify(this.works)
			// 	},
			// 	success: (res) => {
			// 		console.log(res);
			// 		if (res.data) {
						// uni.showToast({
						// 	title: "已提交"
						// })
						// let sc = JSON.parse(res.data)
						// uni.setStorage({
						// 	key: sc.obj.id.toString(),
						// 	data: sc.obj
						// })
						// uni.navigateTo({
						// 	url: `../finish/finish?orderId={{res.data.id}}`,
						// 	success: res => {}
						// });
					// }
				// }
			// })
			
			uni.uploadFile({
				url:this.api.customWorks+"getasd",
				success: (res) => {
					console.log(res);
				}
			})
		},
		methods: {
			but1() {
				uni.chooseImage({
					count: 1,
					sourceType: ['album'],
					success: function(res) {
					}
				})
				// console.log(123)
			},
			select() {
				uni.chooseImage({
					count: 1,
					success: (rst) => {
						// 设置url的值，显示控件
						this.url = rst.tempFilePaths[0];
					}
				});
			},
			onok(ev) {
				this.url = "";
				this.path = ev.path;
			},
			oncancel() {
				// url设置为空，隐藏控件
				this.url = "";
			}
		}
	}
</script>

<style lang="scss">

</style>
